home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_12
/
9n12123b
< prev
next >
Wrap
Text File
|
1991-09-22
|
1KB
|
54 lines
Listing 6
***********
#include <ctype.h>
#include <string.h>
int ind=1,tmp=1;
int mat=1,spc;
main()
{
char text[1024];
getln(text);
putln(text);
printf ("Sentence is %d\n",ind);
printf ("And has %d spaces in it\n",spc);
}
getln(text)
char *text;
{
printf ("Enter Text : ");
while((text[ind-1]=getchar())!='\n')
{
ind++;
}
}
putln(text)
char *text;
{
printf ("Text is : ");
while(text[tmp-1]!='\n')
{
if (mat==1)
{
printf("%c",toupper(text[tmp-1]));
mat=0;
}else{
printf("%c",tolower(text[tmp-1]));
}
if (isspace(text[tmp-1])) {
mat=1;
spc++;}
if (text[tmp-1]=='.' || text[tmp-1]==',') mat=1;
tmp++;
}
printf("\n");
}
*********